package C622;

/**
 * @program: javase
 * @description:
 * @author: luolidong
 * @create: 2021-06-22 19:48
 * @version: 1.0
 */
public class Singleton {
    //构造器私有
    private Singleton() {
    }

    //使用静态内部类创建单例对象
    private static class Inner {
        private static final Singleton singleton = new Singleton();
    }

    //对外提供公共的访问方法
    public static Singleton getInstance() {
        return Inner.singleton;
    }
}
